//Li Zijun 2004-6-25 15:04
//等待对话框使用方法: 
//第一步: <script src="/res/wait.js"></script>
//第二步: <input type="submit" name="subButton" value="提交" onclick="return wait(this,'您确认要提交吗?');">


//显示等待对话框
//objButton:提交按钮本身,this即可
//strConfrim:确认对话框的提示信息,可以不提供
function wait(objButton,strConfrim,strMsg) {
   if (typeof(objButton)=="undefined"){
    	objButton=event.srcElement;
    }    
    
   if (typeof(strConfrim)!="undefined" && strConfrim!=''){
    	if (!window.confirm(strConfrim)){
    	   return false;
    	}
    }
    
    if (typeof(strMsg)=="undefined" || strMsg==''){
        strMsg="处理中,请稍候……";
    }    
    
    var scrollHeight=document.body.scrollTop;//滚动条纵向滚动的高度
    var winHeight = document.body.clientHeight;//窗口高度
    var winWidth  = document.body.clientWidth;//窗口宽度
    var boxHeight=60;//文本框高度
    var boxWidth=200;//文本框宽度
    
    var boxTop=winHeight/2-boxHeight/2+scrollHeight;//文本框左上角所在的纵坐标
    var boxLeft=winWidth/2-boxWidth/2;//文本框左上角所在的横坐标

    var strTalk="<span  style='background:#E4E4E4;POSITION:absolute;padding:20px 40px 20px 40px;"
    +"left:"+boxLeft+";top:"+boxTop+"; width:"+boxWidth+"px; height:"+boxHeight+"px; border:1px solid #666666;'>"+strMsg+"</span>";
    
    //objButton.insertAdjacentHTML("afterEnd",strTalk);
    
    curtain();
    return true;
}



/*
    功能：
        遮挡当前页面

    用法：
        调用curtain()即可

    注意：
        
*/

var isIE5=false;
var isIE6=true;
//var body=document.body;
String.prototype.inc=function(k1,k2){return k2==null?this.indexOf(k1)>-1?true:false:(k2+this+k2).indexOf(k2+k1+k2)>-1?true:false}

function curtain(){
    var scrollHeight=document.body.scrollTop;//滚动条纵向滚动的高度
	oo("bxDlg_bg").style.height=document.body.clientHeight+scrollHeight;
	oo("bxDlg_bg").style.width=document.body.clientWidth;

	dlg_fadeBg(0)   

	ol=document.getElementsByTagName("select")
	for(i=0;i<ol.length;i++){
		hide(ol[i])
	}
	
	show("bxDlg_bg")
}

function oo(obj){
	return typeof(obj)!="string"?obj:(isIE5?document.all(obj):document.getElementById(obj))
}

function show(obj){
	oo(obj).style.visibility=""
}
function hide(obj){
	oo(obj).style.visibility="hidden"
}

function dlg_fadeBg(index){
	if(isIE6){
		oo("bxDlg_bg").innerHTML="<div id=bxDlg_bg1 style=height:100%;background:white;filter:alpha(opacity="+index+")>&nbsp;</div>"
		if(index<15){
			window.setTimeout("dlg_fadeBg("+(index+3)+")",2)
	    }
	}
	else{
		if(index==0){
			oo("bxDlg_bg1").style.visibility=oo("bxDlg_bg2").style.visibility=oo("bxDlg_bg3").style.visibility=oo("bxDlg_bg4").style.visibility=oo("bxDlg_bg5").style.visibility="hidden"
		}else{
			oo("bxDlg_bg"+index).style.visibility=""
		}
		if(index<5){
			window.setTimeout("dlg_fadeBg("+(index+1)+")",10)
		}
	}
}

with (document) {
  write("<span id=bxDlg_bg align=center oncontextmenu=\"return false\" onselectstart=\"return false\" style=\"visibility:hidden;width:100%;position:absolute;left:0;top:0\"></span>");
}